package com.sss.dao;

import com.sss.common.domain.Admin;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

//@Component
@Repository
public class AdminDaoImpl implements AdminDao{
    //dao 注入 SessionFactory
    @Autowired
    private SessionFactory sessionFactory;
    @Override
    public Admin selectAdminById(Integer id) {
        Session session = sessionFactory.openSession();
        //Admin rs = new Admin().setId(id).setName("aaa").setPassword("111");
        return (Admin) session.get(Admin.class,id);
    }
}
